import { defineConfig } from 'vite';

export default defineConfig({
  resolve: {
    alias: {
      moment: 'moment',
      API: '/src/client/components/API',
      '@': '/src',
    },
  },
  server: {
    proxy: {
      '/api/v2': {
        logLevel: 'debug',
        changeOrigin: true,
        target: 'http://127.0.0.1:17894',
        headers: {
          host: '127.0.0.1',
        },
        secure: false,
      },
    },
    hmr: { overlay: false },
  },
  optimizeDeps: {
    include: [
      'subscriptions-transport-ws',
      'fast-json-stable-stringify',
      'zen-observable',
      'change-emitter',
      'hoist-non-react-statics',
      'fbjs',
      'recompose'
    ],
  },
  build: {
    minify: 'terser',
    sourcemap: false,
    terserOptions: {
      compress: {
        // 生产环境时移除console
        drop_console: true,
        drop_debugger: true,
      },
    },
  },
});
